package my.client.security.beans;

import org.springframework.security.GrantedAuthority;

/**
 * @author Nilaksh Bajpai
 */
public class GrantedAuthorityImpl implements GrantedAuthority {

	private static final long serialVersionUID = 1L;
	
	private String authority;

	/**
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	public int compareTo(Object obj) {
		GrantedAuthorityImpl ga = (GrantedAuthorityImpl)obj;
		return ga.getAuthority().compareTo(this.authority);
	}

	/**
	 * @see org.springframework.security.GrantedAuthority#getAuthority()
	 */
	public String getAuthority() {
		return authority;
	}

	/**
	 * @param authority the authority to set
	 */
	public void setAuthority(String authority) {
		this.authority = authority;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return String.format("GrantedAuthorityImpl [authority=%s]", authority);
	}
	
}
